/**
 * 
 */
package fhq.hcmute.edu.vn.message;

import java.security.PrivateKey;
import java.security.PublicKey;

import fhq.hcmute.edu.vn.keyboard.KeyCode;
import fhq.hcmute.edu.vn.network.PhoneInfos;
import fhq.hcmute.edu.vn.system.MyFile;
import fhq.hcmute.edu.vn.system.MyFolder;

/**
 * @author Hien Nguyen Sep 26, 2012
 */
public class MessageFactory extends MyMessage {

	/**
	 * 
	 */
	private static final long serialVersionUID = -8276905683063031213L;

	public static final int PING = 0000001;

	public static final int STOP_SERVER = 1000001;
	public static final int MOVE = 1000002;
	public static final int AUTHENTICATION = 1000003;
	public static final int AUTHENTICATION_REMEMBER = 1000004;
	public static final int PERMISSION = 1000005;
	public static final int PERMISSION_REMEMBER = 1000006;

	// -- TOUCH PAD----
	public static final int MOUSE_CLICK_LEFT = 2000001;
	public static final int MOUSE_CLICK_RIGHT = 2000002;
	public static final int MOUSE_DOUBLE_CLICK = 2000003;
	public static final int MOUSE_SCROLL_UP = 2000004;
	public static final int MOUSE_SCROLL_DOWN = 2000005;
	public static final int MOUSE_DROP = 2000006;
	public static final int MOUSE_DRAP = 2000007;
	public static final int KEYBOARD_PRESS = 3000001;
	public static final int KEYBOARD_COMMAND = 3000002;
	public static final int KEYBOARD_PRESS_LEFT = 3000003;
	public static final int KEYBOARD_PRESS_RIGHT = 3000004;

	public static final int ZOOM_IN = 4000001;
	public static final int ZOOM_OUT = 4000002;

	// -- REMOTE FILE----
	public static final int RETURN = 5000006;
	public static final int CHANGE_DIRECTORY = 5000000;
	public static final int TURN_BACK = 5000001;
	public static final int EXECUTE_FILE = 5000002;
	public static final int REFRESH = 5000003;
	public static final int PWD = 5000004;
	public static final int UP_TO_ROOT = 5000005;
	public static final int SEARCH = 5000006;

	// -- Scanner-------
	public static final int POST_IMAGE = 6000001;
	public static final int CLOSE_IMAGE_FRAME = 6000002;
	public static final int ROTATE_LEFT = 6000003;
	public static final int ROTATE_RIGHT = 6000004;

	public static final int REVIEW_IMAGE = 6000005;
	public static final int REMOVE_IMAGE = 6000006;
	public static final int REMOVE_ALL_IMAGE = 6000007;

	// ---- Prezi -----

	public static final int PREZI_NEXT = 7000001;
	public static final int PREZI_BACK = 7000002;
	public static final int PREZI_ZOOM_IN = 7000003;
	public static final int PREZI_ZOOM_OUT = 7000004;
	public static final int PREZI_ENTER_FULL_SCREEN = 7000005;
	public static final int PREZI_EXIT_FULL_SCREEN = 7000006;
	public static final int PREZI_BLACKOUT = 7000007;

	public MessageFactory() {

	}

	public static MyMessage createPreziNextMessage() {
		return new MyMessage(PREZI_NEXT);
	}

	public static MyMessage createPreziBackMessage() {
		return new MyMessage(PREZI_BACK);
	}

	public static MyMessage createPreziZoomInMessage() {
		return new MyMessage(PREZI_ZOOM_IN);
	}

	public static MyMessage createPreziZoomOutMessage() {
		return new MyMessage(PREZI_ZOOM_OUT);
	}

	public static MyMessage createPreziEnterFullScreenMessage() {
		return new MyMessage(PREZI_ENTER_FULL_SCREEN);
	}

	public static MyMessage createPreziExitFullScreenMessage() {
		return new MyMessage(PREZI_EXIT_FULL_SCREEN);
	}

	public static MyMessage createPreziBlackOutMessage() {
		return new MyMessage(PREZI_BLACKOUT);
	}

	public static MyMessage createRemovewAllImageMessage() {
		return new MyMessage(REMOVE_ALL_IMAGE);
	}

	public static MyMessage createRemovewImageMessage(int index) {
		return new MyMessage(REMOVE_IMAGE, index);
	}

	public static MyMessage createReviewImageMessage(int index) {
		return new MyMessage(REVIEW_IMAGE, index);
	}

	public static MyMessage createRotateImageLeftMessage() {
		return new MyMessage(ROTATE_LEFT);
	}

	public static MyMessage createRotateImageRightMessage() {
		return new MyMessage(ROTATE_RIGHT);
	}

	public static MyMessage createPostImageMessage(int id, byte[] arrByte) {
		return new MyMessage(POST_IMAGE, id, arrByte);
	}

	public static MyMessage createCloseFramwMessage() {
		return new MyMessage(CLOSE_IMAGE_FRAME);
	}

	public static MyMessage createSearchMessage(MyFolder path, String keyword,
			String[] fileType) {
		return new MyMessage(SEARCH, path, keyword, fileType);
	}

	public static MyMessage createChangeDirectoryMessage(final MyFolder mySystem) {
		return new MyMessage(CHANGE_DIRECTORY, mySystem);
	}

	public static MyMessage createExcuteFileMessage(final MyFile mySystem) {
		return new MyMessage(EXECUTE_FILE, mySystem);
	}

	public static MyMessage createTurnBackMessage() {
		return new MyMessage(TURN_BACK);
	}

	public static MyMessage createRefreshMessage() {
		return new MyMessage(REFRESH);
	}

	public static MyMessage createReturnMessage(int from, Object object) {
		MyMessage message = new MyMessage(RETURN, object);
		message.setFrom(from);
		return message;
	}

	public static MyMessage createPWDMessage() {
		return new MyMessage(PWD);
	}

	public static MyMessage createUpToRootMessage() {
		return new MyMessage(UP_TO_ROOT);
	}

	public static MyMessage createConnectMessage(final PhoneInfos phoneInfos) {
		return new MyMessage(AUTHENTICATION, phoneInfos);
	}

	public static MyMessage createConnectMessage(final PhoneInfos phoneInfos,
			PrivateKey privateKey) {
		return new MyMessage(AUTHENTICATION, phoneInfos, privateKey);
	}

	public static MyMessage createPingMessage() {
		return new MyMessage(PING);
	}

	public static MyMessage createStopMessage() {
		return new MyMessage(STOP_SERVER);
	}

	public static MyMessage createMovementMessage(final float xMove,
			final float yMove) {
		return new MyMessage(MOVE, xMove, yMove);
	}


	public static MyMessage createPermissionMessage(final boolean isAllow) {
		return new MyMessage(PERMISSION, isAllow);
	}

	public static MyMessage createPermissionMessage(final boolean isAllow,
			PublicKey privateKey) {
		return new MyMessage(PERMISSION_REMEMBER, isAllow, privateKey);
	}

	public static MyMessage createMouseLeftClickMessage() {
		return new MyMessage(MOUSE_CLICK_LEFT);
	}

	public static MyMessage createMouseRightClickMessage() {
		return new MyMessage(MOUSE_CLICK_RIGHT);
	}

	public static MyMessage createKeyboardPressMessage(int position,
			KeyCode keyCode) {
		return new MyMessage(KEYBOARD_PRESS, position, keyCode);
	}

	public static MyMessage createKeyboardPressLeft(int position) {
		return new MyMessage(KEYBOARD_PRESS_LEFT, position, KeyCode.LEFT);
	}

	public static MyMessage createKeyboardPressRight(int position) {
		return new MyMessage(KEYBOARD_PRESS_RIGHT, position, KeyCode.RIGHT);
	}

	public static MyMessage createKeyboardMoveCursor(int from, int to) {
		return new MyMessage(KEYBOARD_PRESS_RIGHT, from, to);
	}

	public static MyMessage createKeyboardCommandMessage(int position,
			KeyCode keyCode) {
		return new MyMessage(KEYBOARD_COMMAND, position, keyCode);
	}

	public static MyMessage createScrollUpMessage(int mouseScrollSensitive) {
		return new MyMessage(MOUSE_SCROLL_UP, mouseScrollSensitive);
	}

	public static MyMessage createScrollDownMessage(int mouseScrollSensitive) {
		return new MyMessage(MOUSE_SCROLL_DOWN, mouseScrollSensitive);
	}

	public static MyMessage createZoomInMessage() {
		return new MyMessage(ZOOM_IN);
	}

	public static MyMessage createZoomOutMessage() {
		return new MyMessage(ZOOM_OUT);
	}
}
